Release 10.1A: OpenEdge Data Management:
DataServer for Microsoft SQL Server
Transaction scoping and buffer management
The DataServer and an OpenEdge database hold locks differently at transaction boundaries. The OpenEdge database will hold a lock past the transaction boundary where the DataServer will not. This causes different behavior in the use of buffers. Consider the following example:
Executing the above code against an OpenEdge database will downgrade the
EXCLUSIVE-LOCKin Transaction 1 to aSHARE-LOCK. This occurs at the end of Transaction 1 and remains in effect at the time of thePAUSEstatement and prior to the start of Transaction 2. ThisSHARE-LOCKprevents another user from modifying thestate-namevalue between the transactions. As an optimization, when Transaction 2 is executed, the client does not refresh thest_buf1buffer since theSHARE-LOCKprevented its contents from becoming stale between transactions. Also, sincest_buf2will have the same data integrity asst_buf1, they share the same buffer content.Executing the above code against the DataServer will have different results because the DataServer does not retain any lock conditions beyond the scope of the transaction boundary. The DataServer will release the
EXCLUSIVE-LOCKon the record at theENDstatement of Transaction 1. This leaves the record exposed to modification by another client during thePAUSEstatement. If another client modifies thestate-namevalue to “Granite State” during thePAUSE, Transaction 2 will read the updated value during theFINDstatement. However, because of Progress buffering rules and record scoping, neither buffer is refreshed with the updated value and theDISPLAYstatement displays “New Hampshire New Hampshire.”To avoid this type of problem, the following workarounds are available:
- Change the lock status in Transaction 1 to
NO-LOCKif anEXCLUSIVE-LOCKis not required. The lock upgrade in Transaction 2 will force the buffer to be updated in this transaction.- If the lock can not be changed in Transaction 1, release the first buffer before the start of Transaction 2 with the statement “
RELEASEst_buf1.” TheRELEASEstatement will force a refresh of the data when theFINDin Transaction 2 executes.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |